//
//  ViewController.m
//  app管理
//
//  Created by song on 15/1/19.
//  Copyright (c) 2015年 song. All rights reserved.
//

#import "ViewController.h"
#import "JOApp.h"
#import "JOAppCell.h"

@interface ViewController ()

@end

@implementation ViewController


-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return self.apps.count;
}


-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSString *ID=@"app";
    JOAppCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
    cell.app =self.apps[indexPath.row];
    return cell;
}

-(BOOL)prefersStatusBarHidden
{
    return YES;
}


-(NSArray *)apps
{
    if(_apps ==nil)
    {
        NSMutableArray *marray =[NSMutableArray array];
        NSArray *array =[NSArray arrayWithContentsOfFile:[[NSBundle mainBundle]pathForResource:@"apps_full.plist" ofType:nil]];
        
        for (NSDictionary *dict in  array) {
            JOApp *app =[JOApp appWithDict:dict];
            [marray addObject:app];
        }
        _apps = marray;
    }
    
    return _apps;
}


- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
